<template>
  <div class="common-layout">
    <el-container class="lay-container">
      <!-- 左侧边栏 -->
      <el-aside
        style="margin-right: 10px; padding-right: 10px"
        :style="{ width: store.state.isCollapse ? '80px' : '200px' }"
      >
        <component-aside />
      </el-aside>

      <el-container class="right-container">
        <!-- 头部 -->
        <el-header class="el-header">
          <component-header />
        </el-header>
        <component-tags />
        <!-- 内容展示区 -->
        <el-main class="main-content">
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import componentAside from '../components/componentAside.vue';
import componentHeader from '../components/componentHeader.vue';
import { useHomeDataStore } from '../stores/index.js';
import componentTags from '../components/tags.vue';
const store = useHomeDataStore();
</script>

<style scoped lang="less">
/* 根容器布局，去掉默认 margin 和 padding */
.common-layout {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* 容器布局设置 */
.lay-container {
  display: flex;
  flex-direction: row;
  margin: 0;
  padding: 0;
  height: 100vh;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 左侧栏样式 */
:deep(.el-aside) {
  margin-right: 0;
  padding-right: 0;
  background: linear-gradient(180deg, #304156 0%, #2c3e50 100%);
  transition: width 0.3s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* 右侧内容区域 */
.right-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 0;
  overflow: hidden;
  background: #ffffff;
}

/* 头部区域 */
:deep(.el-header) {
  margin-bottom: 0;
  padding: 0;
  height: 60px !important;
  background: linear-gradient(135deg, #304156 0%, #2c3e50 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

/* 标签组件容器 */
.component-tags {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* 主内容区 */
:deep(.el-main) {
  padding: 24px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  overflow-y: auto;
  flex: 1;
  position: relative;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23ffffff" opacity="0.05"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: 0;
  }
  
  > * {
    position: relative;
    z-index: 1;
  }
}

/* 确保容器高度正确 */
:deep(.el-container) {
  height: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
  :deep(.el-main) {
    padding: 16px;
  }
}
</style>
